<?php

namespace mpend\modules\shop\controllers;

use Yii;
use common\helpers\Url;
use mpend\components\Controller;
use common\helpers\ArrayHelper;
use common\models\shop\ShopCart;
use mpend\modules\shop\models\CartSearch;
use mpend\modules\shop\models\CartForm;
use mpend\modules\shop\models\CartPrepareForm;
use mpend\modules\shop\models\CartPackSearch;
use common\logics\DiscountLogic;
use common\logics\FrontUserAddressLogic;
use common\logics\ExpressCalculator;

/**
 * 运费相关接口
 * 
 * @author emhome<emhome@163.com>
 * @since 2.0
 */
class ExpressController extends Controller {

    /**
     * @inheritdoc
     */
    protected function verbs() {
        return [
            '*' => ['POST'],
        ];
    }

    /**
     * 加入购物车
     * @return json
     */
    public function actionReckon() {
        $model = new ExpressCalculator();
        if (!$model->load(Yii::$app->request->post(), '')) {
            return $model->dumpError('运费获取失败');
        }
        return $model->reckon();
    }

}
